﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Collab.Services.Remote.Contracts;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text.RegularExpressions;
using Collab.Services.Remote.Entities;

namespace Collab.Services.Remote.ConsoleDemo
{
    public class Program
    {
        static void Main(string[] args)
        {
            //Binding binding = new NetTcpBinding(SecurityMode.None);
            //var elems = binding.CreateBindingElements();
            //foreach (var item in elems)
            //{
            //    if (item is TcpTransportBindingElement)
            //        (item as TcpTransportBindingElement).TeredoEnabled = true;
            //}
            //CustomBinding custBind = new CustomBinding(elems);
            //Console.WriteLine("Your name:");
            //string name = Console.ReadLine();
            //Console.WriteLine("IP of the service:");
            //string ip = Console.ReadLine();

            ////[2001:0:4137:9e76:4a8:28e2:3f57:feb5]
            //EndpointAddress remoteAddress = new EndpointAddress("net.tcp://" + ip + ":8000/RemoteCollaborationService");

            //IRemoteCollaborationCallback callback = new RemoteCollaborationCallback();
            //RemoteCollaborationServiceProxy proxy = new RemoteCollaborationServiceProxy(new User(){Id = new Guid(), Name = name}, callback, custBind, remoteAddress);

            ////callback.WhenUserConnected += user => Console.WriteLine(user.Name + " connected");
            ////callback.WhenUserDisconnected += user => Console.WriteLine(user.Name + " disconnected");

            //string input = String.Empty;
            //while (input != "Exit")
            //{
            //    input = Console.ReadLine();

            //    try
            //    {
            //        Match join = Regex.Match(input, @"Change");
            //        if (join.Success)
            //            proxy.SendChange(new Change(new Guid(), 1, 1, 1, 1, ""));
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine("Invalid input:" + ex.Message);
            //    }
            //}

            //proxy.Dispose();
        }
    }
}
